﻿<!-- 管理站配置 -->
<template>
    <div>
        <!-- 添加按钮 -->
        <div class="btn-add">
            <button type="button" class="btn btn-info btn-lg" @click="showdv()"><i class="iconfont icon-xinjian ft12 mr5"></i>设置奖励系数</button>
        </div>
        <!-- 按条件选择 -->

        <div class="default-tab ft14  hover-btn" style="overflow-x: inherit;padding:20PX;padding-top:10px;margin-top:60px">
            <base-table :pzoption="tableop" @selection-change="handleSelectionChange">
            </base-table>
        </div>
        <div class="modal fade dx" id="ZGModal" role="dialog">
            <div class="modal-dialog" role="document" style="width: 500px">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                        <h4 class="modal-title">
                            设置奖励系数
                        </h4>

                    </div>
                    <div class="modal-body" style="min-height: 100px;text-align: center; margin-top: 50PX;">
                        <el-form ref="form"  label-width="180px">
                            <el-form-item label="协会奖励系数">
                                <el-input-number v-model="xhfl" size="mini" controls-position="right" :min="0" :max="1" :precision="2" :step="0.01"></el-input-number>
                            </el-form-item>
                            <el-form-item label="小组奖励系数">
                                <el-input-number v-model="xzfl" size="mini" controls-position="right" :min="0" :max="1" :precision="2" :step="0.01"></el-input-number>
                            </el-form-item>
                        </el-form>
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                        <button type="button" class="btn btn-info" @click="SaveData()">确认</button>

                    </div>
                </div>
            </div>
        </div>

        <!-- 表格 -->



    </div>
</template>

<script>
    module.exports = {
        props: ['pdata'],
        components: {
            'base-table': httpVueLoader('/ViewV5/Base/Vue/Table.vue')
        },
        data: function () {
            return {
                zz: "",
                type: "0",
                xhfl: 1,
                xzfl: 1,
                alldata: [],
                zzdata: [],
                DeptCodes: [],
                tableop: {
                    title: "管理站奖励系数信息",
                    issel: true,
                    iscz: false,
                    height: 500,
                    isxh: true,
                    loading: true,
                    dataset: [],
                    multipleSelection: [],
                    collist: [
                        { colid: "DeptCode", colname: "DeptCode", isshow: false, istip: true },
                        { colid: "DeptName", colname: "管理站", isshow: true, istip: true },
                        { colid: "xhfl", colname: "协会奖励系数", isshow: true, istip: true },
                        { colid: "xzfl", colname: "小组奖励系数", isshow: true, istip: true }
                    ]
                }
            }
        },
        methods: {

            handleSelectionChange(val) {
                this.tableop.multipleSelection = val;
            },
            showdv: function () {
                var pro = this;
                var DeptCodes = [];
                for (var i = 0; i < pro.tableop.multipleSelection.length; i++) {
                    DeptCodes.push(pro.tableop.multipleSelection[i].DeptCode);
                }
                if (DeptCodes.length == 0) {
                    pro.$notify.error({
                        title: '错误',
                        message: '至少需要选择一条数据才能操作'
                    });
                    return;
                }
                pro.DeptCodes = DeptCodes;
                $('#ZGModal').modal('show');

            },
            SaveData: function () {
                var pro = this;               
                $.getJSON("/api/Bll/ExeAction?Action=SFJS_GLZSETJLZK", { P1: pro.DeptCodes.join(), P2: pro.type, xhfl: pro.xhfl, xzfl: pro.xzfl },
                    function (resultData) {
                        if (!resultData.ErrorMsg) {
                            $('#ZGModal').modal('hide');
                            pro.$notify({
                                title: '成功',
                                message: '操作成功',
                                type: 'success'
                            });
                            pro.querydata();
                        }
                    }
                )
            },
            querydata: function () {
                var pro = this;
                pro.tableop.loading = true;
                $.getJSON('/api/Auth/ExeAction?Action=GETALLBMNEW', { P1: pro.zz }, function (resultData) {
                    if (!resultData.ErrorMsg) {
                        pro.tableop.dataset = _.filter(resultData.Result[0].ChildBranch, function (obj) {
                            return obj.Remark2 == 'Y';
                        });
                        pro.tableop.loading = false;
                    }
                })


            },
            InitWigetData: function () {
                this.querydata();
            },
        },
        watch: {

        },
        mounted: function () {
            var pro = this;
            pro.$nextTick(function () {
                pro.InitWigetData();
            })

        }
    };
</script>